﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.SqlClient;
using jiaju.Models;
using jiaju.Models.DBModel;
using jiaju.Models.DAL;

namespace jiaju.Controllers
{
    public class MessageController : Controller
    {
        // GET: Message
        public ActionResult Index()
        {
            //留言板
            Message LiuYan = MessageService.getMessage();
            ViewBag.A = LiuYan;
            return View();
        }
        [HttpPost]
        [ValidateInput(false)]
        public ActionResult Messagesub(Message art)
        {            
            int n = MessageService.SubMessage(art);
            if (n > 0)
            {
                return Json(new { success = true, msg = "留言成功，请耐心等待!!!" });
            }
            else
            {
                return Json(new { success = false, msg = "留言失败，请重新输入!!!" });
            }
        }
    }
}